package com.woniuxy.service.impl;


import com.woniuxy.entity.User;
import com.woniuxy.mapper.LoginMapper;
import com.woniuxy.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

@Service
public class LoginServiceImpl implements LoginService {
    @Autowired
    private LoginMapper loginMapper;

    @Autowired
    private JavaMailSender javaMailSender;
    @Override
    public User login(String account, String password) {
        return loginMapper.login(account, password);
    }

//    public void sendSimpleEmail(String to, String subject, String text) {
//        SimpleMailMessage message = new SimpleMailMessage();
//        message.setTo(to);
//        message.setSubject(subject);
//        message.setText(text);
//        javaMailSender.send(message);
//    }

    @Override
    public User getUserByEmail(String email) {
        return loginMapper.getUserByEmail(email);
    }
}
